﻿
/*----------------------------------------------------------------//
// 文件名：MoTestItem.cs
// 文件功能描述：实体 MoTestItem.
// 
// 创建标识：2009-03-10
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------*/
#region MoTestItem
using System;
using System.Data;
using System.Globalization;
using System.Text;
using System.Xml;
using System.Data.Common;
namespace EQT.Model
{
	/// <summary>
	/// 业务实体MoTestItem
	/// </summary>
	public partial class MoTestItem:ICloneable
	{
		#region 表TestItem的字段
		private string _item_code;
		private string _dept_id;
		private string _test_parameters;
		private decimal _price;
		private int _ability_status;
		#endregion
		
		#region 构造函数
		public MoTestItem()
		{
		    
		    
		    
		    
		    
		}
		#endregion
		
		#region 拷贝构造函数

		public MoTestItem(MoTestItem item)
		{
			item.CopyTo(this);
		}
		#endregion
		
		#region 带参数构造函数
	    public MoTestItem(string item_code,string dept_id,string test_parameters,decimal price,int ability_status)
		{
		this._item_code=item_code;
		this._dept_id=dept_id;
		this._test_parameters=test_parameters;
		this._price=price;
		this._ability_status=ability_status;
		}
		#endregion
		
		#region 表TestItem的字段属性
		/// <summary>
		/// ITEM_CODE
		/// </summary>
		public string Item_Code
		{
			get {return _item_code;}
			set {_item_code=value;}
		}
		/// <summary>
		/// DEPT_ID
		/// </summary>
		public string Dept_Id
		{
			get {return _dept_id;}
			set {_dept_id=value;}
		}
		/// <summary>
		/// TEST_PARAMETERS
		/// </summary>
		public string Test_Parameters
		{
			get {return _test_parameters;}
			set {_test_parameters=value;}
		}
		/// <summary>
		/// PRICE
		/// </summary>
		public decimal Price
		{
			get {return _price;}
			set {_price=value;}
		}
		/// <summary>
		///能力状态目前有3种：1--不可进行，2--可以进行，0--未知
		/// </summary>
		public int Ability_Status
		{
			get {return _ability_status;}
			set {_ability_status=value;}
		}
		#endregion
		
		#region 辅助函数
		/// <summary>
		/// 拷贝函数
		/// </summary>
		public MoTestItem CopyTo(MoTestItem item)
        {
		    item.Item_Code=this.Item_Code;
		    item.Dept_Id=this.Dept_Id;
		    item.Test_Parameters=this.Test_Parameters;
		    item.Price=this.Price;
		    item.Ability_Status=this.Ability_Status;
			return item;
        }
		/// <summary>
		/// 克隆函数
		/// </summary>		
		public object Clone()
        {
            MoTestItem NewTestItem=new MoTestItem();
		    NewTestItem._item_code=this._item_code;
		    NewTestItem._dept_id=this._dept_id;
		    NewTestItem._test_parameters=this._test_parameters;
		    NewTestItem._price=this._price;
		    NewTestItem._ability_status=this._ability_status;
			return NewTestItem;
		}
		
		private static MoTestItem _empty = new MoTestItem(string.Empty,string.Empty,string.Empty,0,-1);
        public static MoTestItem Empty
        {
            get
            {
                return _empty;
            }
        }
		
		///<summary>
		///判断对象是否相等
		///<summary>
		public override bool Equals(object obj)
        {
            if (base.Equals(obj))
            {
                return true;
            }
            else
            {
                MoTestItem NewTestItem = obj as MoTestItem;
                if (NewTestItem == null)
                {
                    return false;
                }
                else
                {
				if (NewTestItem.Item_Code==this.Item_Code && NewTestItem.Dept_Id==this.Dept_Id && NewTestItem.Test_Parameters==this.Test_Parameters && NewTestItem.Price==this.Price && NewTestItem.Ability_Status==this.Ability_Status)		
					{
                        return true; 
                    }
                }

            }
            return false;
            
        }
		///TODO:you should modify GetHashCode by yourself.
		public override int GetHashCode()
		{
			return base.GetHashCode();
		} 

		public override string ToString()
        {
		   return String.Format("Item_Code={0}/Dept_Id={1}/Test_Parameters={2}/Price={3}/Ability_Status={4}",_item_code,_dept_id,_test_parameters,_price,_ability_status);
		 
		}
		#endregion
		
		#region DataTable Help Function
		///<summary>
		///DataRow转换成Model
		///</summary>
		public void Row2Model(DataRow row)
		{
		    if(row["Item_Code"]!=null && row["Item_Code"]!=DBNull.Value)
			{
			    this.Item_Code = (string)row["Item_Code"];
			}
			else
			{
				this.Item_Code =string.Empty;
			}
		    if(row["Dept_ID"]!=null && row["Dept_ID"]!=DBNull.Value)
			{
			    this.Dept_Id = (string)row["Dept_ID"];
			}
			else
			{
				this.Dept_Id =string.Empty;
			}
		    if(row["Test_Parameters"]!=null && row["Test_Parameters"]!=DBNull.Value)
			{
			    this.Test_Parameters = (string)row["Test_Parameters"];
			}
			else
			{
				this.Test_Parameters =string.Empty;
			}
		    if(row["Price"]!=null && row["Price"]!=DBNull.Value)
			{
			    this.Price = (decimal)row["Price"];
			}
			else
			{
				this.Price =0;
			}
		    if(row["Ability_Status"]!=null && row["Ability_Status"]!=DBNull.Value)
			{
			    this.Ability_Status = (int)row["Ability_Status"];
			}
			else
			{
				this.Ability_Status =-1;
			}
		}
		
		///<summary>
		///Model转换成DataRow
		///</summary>
	　　public void Model2Row(DataRow row)
		{
			row["Item_Code"] = this.Item_Code;
			row["Dept_ID"] = this.Dept_Id;
			row["Test_Parameters"] = this.Test_Parameters;
			row["Price"] = this.Price;
			row["Ability_Status"] = this.Ability_Status;
		}
		#endregion
	}
}
#endregion
